home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Apple Game Sprockets / More Sprocket Examples 1.0 / GlyphaIV Sources / G4Interface.c < prev    next >
Encoding:
Text File  |  1996-06-12  |  18.4 KB  |  608 lines  |  [TEXT/CWIE]

  1.  
  2. //============================================================================
  3. //----------------------------------------------------------------------------
  4. //                                    Interface.c
  5. //----------------------------------------------------------------------------
  6. //============================================================================
  7.  
  8. // I put all interface related code in here.  Interface would include event…
  9. // handling, menus, dialog boxes, etc.  All the user interaction that takes…
  10. // place before and after an actual game is in play.
  11.  
  12. #include "G4Externs.h"
  13. #include <Sound.h>
  14. #include <Devices.h>
  15. #include <AppleEvents.h>
  16. #include <ToolUtils.h>
  17.  
  18. #define kAppleMenuID        128
  19. #define iAbout                1
  20. #define kGameMenuID            129
  21. #define iNewGame            1
  22. #define iPauseGame            2
  23. #define iEndGame            3
  24. #define iQuit                5
  25. #define kOptionsMenuID        130
  26. #define iSettings            1
  27. #define iHelp                2
  28. #define iHighScores            3
  29. #define kAboutPictID        132
  30.  
  31.  
  32. void DoAppleMenu (short);
  33. void DoGameMenu (short);
  34. void DoOptionsMenu (short);
  35. void UpdateMainWindow (void);
  36. void HandleMouseEvent (EventRecord *);
  37. void HandleKeyEvent (EventRecord *);
  38. void HandleUpdateEvent (EventRecord *);
  39. void HandleOSEvent (EventRecord *);
  40. void HandleHighLevelEvent (EventRecord *);
  41. void DoAbout (void);
  42. void DoGameSettings (void);
  43. void DrawBanner(void);
  44.  
  45. Rect        mainWindowRect;
  46.  
  47.  
  48. MenuHandle    appleMenu, gameMenu, optionsMenu;
  49. Boolean        switchedOut, quitting, canPlay, openTheScores;
  50.  
  51. extern    prefsInfo    thePrefs;
  52. extern    Rect        backSrcRect, workSrcRect;
  53. extern    CGrafPtr    backSrcMap, workSrcMap;
  54. extern    Boolean        pausing, playing, helpOpen, scoresOpen;
  55.  
  56.  
  57. //==============================================================  Functions
  58. //--------------------------------------------------------------  MenusReflectMode
  59.  
  60. // Depending on whether a game is in progress (paused) or not, I want…
  61. // menu items grayed out in one case and not grayed out in the other.
  62. // This function, when called, displays the menus correctly depending…
  63. // on the mode we're in (playing or not playing, pausing or not).
  64.  
  65. void MenusReflectMode (void)
  66. {
  67.     if (playing)                                // If a game is in progress…
  68.     {
  69.         DisableItem(gameMenu, iNewGame);        // Cannot begin another New Game.
  70.         EnableItem(gameMenu, iPauseGame);        // Can Pause Game.
  71.         if (pausing)                            // If we are paused…
  72.             SetItem(gameMenu, iPauseGame, 
  73.                     "\pResume Game");            // Rename item "Resume Game".
  74.         else                                    // If we are not paused…
  75.             SetItem(gameMenu, iPauseGame, 
  76.                     "\pPause Game");            // Rename item "Pause Game".
  77.         EnableItem(gameMenu, iEndGame);            // Can End Game.
  78.         DisableItem(optionsMenu, 0);            // Cannot change game settings.
  79.     }
  80.     else                                        // Else, if Glypha is idle…
  81.     {
  82.         EnableItem(gameMenu, iNewGame);            // Can begin a New Game.
  83.         DisableItem(gameMenu, iPauseGame);        // Cannot Pause Game.
  84.         SetItem(gameMenu, iPauseGame, 
  85.                 "\pPause Game");                // Rename item "Pause Game".
  86.         DisableItem(gameMenu, iEndGame);        // Cannot End Game.
  87.         EnableItem(optionsMenu, 0);                // Can change game settings.
  88.     }
  89. }
  90.  
  91. //--------------------------------------------------------------  DoAppleMenu
  92.  
  93. // This function takes care of handling the Apple menu (Desk Assecories and the…
  94. // About box).
  95.  
  96. void DoAppleMenu (short theItem)
  97. {
  98.     Str255        daName;
  99.     GrafPtr        wasPort;
  100.     short        daNumber;
  101.     
  102.     switch (theItem)                            // Depending on the item selected…
  103.     {
  104.         case iAbout:                            // If the About item was selected…
  105.         if ((scoresOpen) || (helpOpen))            // If high scores or help screens up…
  106.         {
  107.             CloseWall();                        // hide them.
  108.             scoresOpen = FALSE;                    // High scores no longer open.
  109.             helpOpen = FALSE;                    // Help screen is no longer open.
  110.                                                 // Uncheck help & high scores menu items.
  111.             CheckItem(optionsMenu, iHelp, helpOpen);
  112.             CheckItem(optionsMenu, iHighScores, scoresOpen);
  113.         }
  114.         DoAbout();                                // Bring up the About dialog.
  115.         break;
  116.         
  117.         default:                                // If any other item was selected (DA)…
  118.         GetItem(appleMenu, theItem, daName);    // Get the name of the item selected.
  119.         GetPort(&wasPort);                        // Remember our port.
  120.         daNumber = OpenDeskAcc(daName);            // Launch the Desk Accesory.
  121.         SetPort((GrafPtr)wasPort);                // When we return, restore port.
  122.         break;
  123.     }
  124. }
  125.  
  126. //--------------------------------------------------------------  DoGameMenu
  127.  
  128. // This function handles a users interaction with the Game menu.  Quitting…
  129. // Glypha, starting a new game, resuming a paused game are handled here.
  130.  
  131. void DoGameMenu (short theItem)
  132. {
  133.     switch (theItem)                        // Depending on menu item selected…
  134.     {
  135.         case iNewGame:                        // If user selected New Game item…
  136.         if ((scoresOpen) || (helpOpen))        // If high scores or help screen is up,…
  137.         {                                    // close them first.
  138.             CloseWall();
  139.             scoresOpen = FALSE;
  140.             helpOpen = FALSE;
  141.             CheckItem(optionsMenu, iHelp, helpOpen);
  142.             CheckItem(optionsMenu, iHighScores, scoresOpen);
  143.         }
  144.         InitNewGame();                        // Initialize variables for a new game.
  145.         MenusReflectMode();                    // Properly gray out the right menu items.
  146.         break;
  147.         
  148.         case iPauseGame:                    // If user selected Pause Game item…
  149.         if (pausing)                        // If we are paused, resume playing.
  150.         {
  151.             pausing = FALSE;                // Turn off pausing flag.
  152.             DumpBackToWorkMap();            // Restore off screen just in case.
  153.         }                                    // Actually pausing a game (not resuming)…
  154.         break;                                // is not really handled here.  It's handled…
  155.                                             // directly within the main game loop.
  156.                                             
  157.         case iEndGame:                        // Ending a game in progress isn't really…
  158.         break;                                // handled here - this is a dummy item.
  159.                                             // Ending a game is handled within the main…
  160.                                             // game loop by looking for the 'command'…
  161.                                             // and 'E' key explicitly.
  162.         
  163.         case iQuit:                            // If user selected Quit item…
  164.         quitting = TRUE;                    // Set quitting flag to TRUE.
  165.         break;
  166.     }
  167. }
  168.  
  169. //--------------------------------------------------------------  DoOptionsMenu
  170.  
  171. // This function handles the Options menu.  Options include game settings,…
  172. // displaying the high scores, and bringing up the Help screen.
  173.  
  174. void DoOptionsMenu (short theItem)
  175. {
  176.     switch (theItem)                    // Depending on which item the user selected…
  177.     {
  178.         case iSettings:                    // If user selected Game Settings item…
  179.         if ((scoresOpen) || (helpOpen))    // Close high scores or help screen.
  180.         {
  181.             CloseWall();
  182.             scoresOpen = FALSE;
  183.             helpOpen = FALSE;
  184.             CheckItem(optionsMenu, iHelp, helpOpen);
  185.             CheckItem(optionsMenu, iHighScores, scoresOpen);
  186.         }
  187.         DoGameSettings();                // Bring up game settings dialog.
  188.         break;
  189.         
  190.         case iHelp:                        // If user selected Help item…
  191.         if (helpOpen)                    // If Help open, close it.
  192.         {
  193.             CloseWall();
  194.             helpOpen = FALSE;
  195.         }
  196.         else                            // Else, if Help is not open - open it.
  197.         {
  198.             if (scoresOpen)                // If the High Scores are up though,…
  199.             {
  200.                 CloseWall();            // Close them first.
  201.                 scoresOpen = FALSE;
  202.                 CheckItem(optionsMenu, iHighScores, scoresOpen);
  203.             }
  204.             OpenHelp();                    // Now open the Help screen.
  205.         }
  206.         CheckItem(optionsMenu, iHelp, helpOpen);
  207.         break;
  208.         
  209.         case iHighScores:                // If user selected High Scores…
  210.         if (scoresOpen)                    // If the High Scores are up, close them.
  211.         {
  212.             CloseWall();
  213.             scoresOpen = FALSE;
  214.         }
  215.         else                            // If the High Scores are not up…
  216.         {
  217.             if (helpOpen)                // First see if Help is open.
  218.             {
  219.                 CloseWall();            // And close the Help screen.
  220.                 helpOpen = FALSE;
  221.                 CheckItem(optionsMenu, iHelp, helpOpen);
  222.             }
  223.             OpenHighScores();            // Now open the High Scores.
  224.         }
  225.         CheckItem(optionsMenu, iHighScores, scoresOpen);
  226.         break;
  227.     }
  228. }
  229.  
  230. //--------------------------------------------------------------  DoMenuChoice
  231.  
  232. // This is the main menu-handling function.  It examines which menu was selected…
  233. // by the user and passes on to the appropriate function, the item within that…
  234. // menu that was selected.
  235.  
  236. void DoMenuChoice (long menuChoice)
  237. {
  238.     short        theMenu, theItem;
  239.     
  240.     if (menuChoice == 0)            // A little error checking.
  241.         return;
  242.     
  243.     theMenu = HiWord(menuChoice);    // Extract which menu was selected.
  244.     theItem = LoWord(menuChoice);    // Extract which item it was that was selected.
  245.     
  246.     switch (theMenu)                // Now, depending upon which menu was selected…
  247.     {
  248.         case kAppleMenuID:            // If the Apple menu selected…
  249.         DoAppleMenu(theItem);        // Call the function that handles the Apple menu.
  250.         break;
  251.         
  252.         case kGameMenuID:            // If the Game menu selected…
  253.         DoGameMenu(theItem);        // Call the function that handles the Game menu.
  254.         break;
  255.         
  256.         case kOptionsMenuID:        // If the Options menu selected…
  257.         DoOptionsMenu(theItem);        // Call the function that handles the Options menu.
  258.         break;
  259.     }
  260.     
  261.     HiliteMenu(0);                    // "De-invert" menu.
  262. }
  263.  
  264. //--------------------------------------------------------------  UpdateMainWindow
  265.  
  266. // This is a simple function that simply copies the contents from the…
  267. // background offscreen pixmap to the main screen.  It is primarily…
  268. // called in response to an update event, but could be called any time…
  269. // when I want to force the screen to be redrawn.
  270.  
  271. void UpdateMainWindow (void)
  272. {
  273.     OSStatus theError;
  274.     
  275.     theError = DSpContext_GetBackBuffer( gTheContext, kDSpBufferKind_Normal, &workSrcMap );
  276.     if( theError )
  277.     {
  278.         DSpContext_Release( gTheContext );
  279.         gTheContext = NULL;
  280.         RedAlert("\pUnable to get back buffer");
  281.     }
  282.  
  283.     CopyBits(&((GrafPtr)backSrcMap)->portBits, 
  284.             &(((GrafPtr)workSrcMap)->portBits), 
  285.             &mainWindowRect, &mainWindowRect, 
  286.             srcCopy, 0L);
  287.  
  288.     DSpContext_SwapBuffers( gTheContext, NULL, NULL );
  289. }
  290.  
  291. //--------------------------------------------------------------  HandleMouseEvent
  292.  
  293. // Mouse clicks come here.  This is standard event-handling drivel.  No different 
  294. // from any other standard Mac program (game or otherwise).
  295.  
  296. void HandleMouseEvent (EventRecord *theEvent)
  297. {
  298.     WindowPtr    whichWindow;
  299.     long        menuChoice;
  300.     short        thePart;
  301.                                                 // Determine window and where in window.
  302.     thePart = FindWindow(theEvent->where, &whichWindow);
  303.     
  304.     switch (thePart)                            // Depending on where mouse was clicked…
  305.     {
  306.         case inSysWindow:                        // In a Desk Accesory.
  307.         SystemClick(theEvent, whichWindow);        // (Is this stuff obsolete yet?)
  308.         break;
  309.         
  310.         case inMenuBar:                            // Selected a menu item.
  311.         menuChoice = MenuSelect(theEvent->where);
  312.         if (canPlay)                            // Call menu handling routine.
  313.             DoMenuChoice(menuChoice);
  314.         break;
  315.         
  316.         case inDrag:                            // Like the lazy bastard I am…
  317.         case inGoAway:                            // I'll just ignore these.
  318.         case inGrow:                            // But, hey, the window isn't…
  319.         case inZoomIn:                            // movable or growable!
  320.         case inZoomOut:
  321.         break;
  322.         
  323.         case inContent:                            // Click in the window itself.
  324.         if (!playing)
  325.         {
  326.             short h = theEvent->where.h;
  327.             short v = theEvent->where.v;
  328.             short count = 10;
  329.             
  330.             while(count > 0)
  331.             {
  332.                 StartPixelShatter(h, v, 0, 0, kShatterLightningDust);
  333.                 count--;
  334.             }
  335.             
  336.             lightH = h;
  337.             lightV = v;
  338.             lightningCount = 15;
  339.             PlayExternalSound(kLightningSound, kLightningPriority);
  340.         }
  341.         break;
  342.     }
  343. }
  344.  
  345. //--------------------------------------------------------------  HandleKeyEvent
  346.  
  347. // More standard issue.  This function handles any keystrokes when no game is
  348. // in session.  Command-key strokes handled here too.
  349.  
  350. void HandleKeyEvent (EventRecord *theEvent)
  351. {
  352.     char        theChar;
  353.     Boolean        commandDown;
  354.     
  355.     theChar = theEvent->message & charCodeMask;                // Extract key hit.
  356.     commandDown = ((theEvent->modifiers & cmdKey) != 0);    // See if command key down.
  357.     
  358.     if (commandDown)                                // If command key down, call menu…
  359.     {                                                // handling routine.
  360.         if (canPlay)
  361.             DoMenuChoice(MenuKey(theChar));
  362.     }
  363.     else
  364.     {
  365.         if (helpOpen)                                // Handle special keys if the help…
  366.         {                                            // screen is up.
  367.             if (theChar == kUpArrowKeyASCII)        // Up arrow key scrolls help down.
  368.             {
  369.                 if (theEvent->what == autoKey)
  370.                     ScrollHelp(-3);
  371.                 else
  372.                     ScrollHelp(-1);
  373.             }
  374.             else if (theChar == kDownArrowKeyASCII)    // Down arrow key scrolls help up.
  375.             {
  376.                 if (theEvent->what == autoKey)
  377.                     ScrollHelp(3);
  378.                 else
  379.                     ScrollHelp(1);
  380.             }
  381.             else if (theChar == kPageDownKeyASCII)    // Handle page down for help screen.
  382.             {
  383.                 ScrollHelp(199);
  384.             }
  385.             else if (theChar == kPageUpKeyASCII)    // Handle page up for help.
  386.             {
  387.                 ScrollHelp(-199);
  388.             }
  389.             else if ((theChar == kHelpKeyASCII) && (!playing))
  390.             {                                        // Hitting Help key closes help…
  391.                 CloseWall();                        // (if it's already open).
  392.                 helpOpen = FALSE;
  393.                 CheckItem(optionsMenu, iHelp, helpOpen);
  394.             }
  395.         }
  396.         else if ((theChar == kHelpKeyASCII) && (!playing))
  397.         {                                            // Else, if help not open and Help…
  398.             if (scoresOpen)                            // key is hit, open Help.
  399.             {                                        // Close high scores if open.
  400.                 CloseWall();
  401.                 scoresOpen = FALSE;
  402.                 CheckItem(optionsMenu, iHighScores, scoresOpen);
  403.             }
  404.             OpenHelp();                                // Open help.
  405.             CheckItem(optionsMenu, iHelp, helpOpen);
  406.         }
  407.     }
  408. }
  409.  
  410. //--------------------------------------------------------------  HandleUpdateEvent
  411.  
  412. // This function handles update events.  Standard event-handling stuff.
  413.  
  414. void HandleUpdateEvent (EventRecord *theEvent)
  415. {    
  416. #if !GENERATINGPOWERPC
  417.     if ((WindowPtr)theEvent->message == mainWindow)
  418.     {
  419.         SetPort((GrafPtr)mainWindow);        // Don't forget this line, BTW.
  420.         BeginUpdate((GrafPtr)mainWindow);    // I did once and it took me…
  421.         UpdateMainWindow();                    // ages to track down that bug.
  422.         EndUpdate((GrafPtr)mainWindow);        // Well, it took me a week I think.
  423.         canPlay = TRUE;
  424.     }
  425. #endif
  426. }
  427.  
  428. //--------------------------------------------------------------  HandleOSEvent
  429.  
  430. // Handle switchin in and out events.  Standard event-handling stuff.
  431.  
  432. void HandleOSEvent (EventRecord *theEvent)
  433. {    
  434.     if (theEvent->message & 0x01000000)        // If suspend or resume event…
  435.     {
  436.         if (theEvent->message & 0x00000001)    // Specifically, if resume event…
  437.             switchedOut = FALSE;            // I keep thinking I should do more here.
  438.         else                                // Or if suspend event…
  439.             switchedOut = TRUE;                // What am I forgetting?
  440.     }
  441. }
  442.  
  443. //--------------------------------------------------------------  HandleHighLevelEvent
  444.  
  445. // Again, it's a fact I'm lazy.  AppleEvents are fairly easy to implement but…
  446. // a nightmare to try and explain.  Filling out the below function is left as…
  447. // and exercise to the reader.
  448.  
  449. void HandleHighLevelEvent (EventRecord *theEvent)
  450. {    
  451. //    theErr = AEProcessAppleEvent(theEvent);
  452. }
  453.  
  454. //--------------------------------------------------------------  HandleEvent
  455.  
  456. // Standard event stuff.  This is the culling function that calls all the above…
  457. // functions.  It looks for an event and if it detects one, it calls the appropriate…
  458. // function above to handle it.
  459.  
  460. void HandleEvent (void)
  461. {
  462.     EventRecord    theEvent;
  463.     long        sleep = 0L;
  464.     Boolean        itHappened;
  465.                                             // See if an event is queued up.
  466. #if GENERATINGPOWERPC
  467.         canPlay = TRUE;
  468. #endif
  469.  
  470.     itHappened = WaitNextEvent(everyEvent, &theEvent, sleep, 0L);
  471.     
  472.     if (itHappened)                            // Ah, an event.  I live for events!
  473.     {
  474.         switch (theEvent.what)                // And what kind of event be ya'?
  475.         {
  476.             case mouseDown:                    // Aiy!  Y' be a mouse click do ya'?
  477.             HandleMouseEvent(&theEvent);
  478.             break;
  479.             
  480.             case keyDown:                    // Key down, key held down events.
  481.             case autoKey:
  482.             HandleKeyEvent(&theEvent);
  483.             break;
  484.             
  485.             case updateEvt:                    // Something needs redrawing!
  486.             HandleUpdateEvent(&theEvent);
  487.             break;
  488.             
  489.             case osEvt:                        // Switching in and out events.
  490.             HandleOSEvent(&theEvent);
  491.             break;
  492.             
  493.             case kHighLevelEvent:            // Hmmmm.  A "what" event?
  494.             HandleHighLevelEvent(&theEvent);
  495.             break;
  496.             
  497.             default:
  498.             break;
  499.         }
  500.     }
  501.     
  502.  
  503. #if 0
  504.     else if (openTheScores)                    // Check for "auto open" flag.
  505.     {                                        // If TRUE, set the flag back to…
  506.         openTheScores = FALSE;                // FALSE and open the high scores.
  507.         OpenHighScores();
  508.     }
  509. #endif
  510. }
  511.  
  512. //--------------------------------------------------------------  DoAbout
  513.  
  514. // This handles the About dialog.  It brings up the About box in a…
  515. // simple centered window with no drag bar, close box or anything.
  516. // Leaving the dialog is handled with a simple mouse click.
  517.  
  518. void DoAbout (void)
  519. {
  520.     Rect        aboutRect;
  521.     WindowPtr    aboutWindow;
  522.     
  523.     SetRect(&aboutRect, 0, 0, 325, 318);        // Bring up centered window.
  524.     CenterRectInRect(&aboutRect, &qd.screenBits.bounds);
  525.     aboutWindow = GetNewCWindow(129, 0L, kPutInFront);
  526.     MoveWindow((GrafPtr)aboutWindow, aboutRect.left, aboutRect.top, TRUE);
  527.     ShowWindow((GrafPtr)aboutWindow);
  528.     SetPort((GrafPtr)aboutWindow);
  529.     LoadGraphic(kAboutPictID);                    // Draw About dialog graphic.
  530.     
  531.     do                                            // Make sure button not down…
  532.     {                                            // before proceeding.
  533.     }
  534.     while (Button());                            // Proceed.
  535.     do                                            // And now wait until the mouse…
  536.     {                                            // is pressed before closing the…
  537.     }                                            // window (ABout dialog).
  538.     while (!Button());
  539.     
  540.     FlushEvents(everyEvent, 0);                    // Flush the queue.
  541.     
  542.     if (aboutWindow != 0L)
  543.         DisposeWindow(aboutWindow);                // Close the About dialog.
  544. }
  545.  
  546. //--------------------------------------------------------------  DoGameSettings
  547.  
  548. // This one however is a good and proper dialog box.  It handles the meager…
  549. // preference settings for Glypha.  Nothing fancy here to report.  Just a…
  550. // straight-forward dialog calling routine.
  551.  
  552. void DoGameSettings (void)
  553. {
  554.     #define        kGameSettingsDialogID    133
  555.     DialogPtr    theDial;
  556.     long        newVolume;
  557.     short        i, item;
  558.     Boolean        leaving;
  559.     
  560.     CenterDialog(kGameSettingsDialogID);    // Center dialog, then call up.
  561.     theDial = GetNewDialog(kGameSettingsDialogID, 0L, kPutInFront);
  562.     SetPort((GrafPtr)theDial);
  563.     ShowWindow((GrafPtr)theDial);            // Make visible (after centering).
  564.     DrawDefaultButton(theDial);                // Draw border around Okay button.
  565.     FlushEvents(everyEvent, 0);
  566.                                             // Put in a default sound volume.
  567.     SetDialogNumToStr(theDial, 3, (long)thePrefs.wasVolume);
  568.     SelIText(theDial, 3, 0, 1024);            // Select it.
  569.     
  570.     leaving = FALSE;
  571.     
  572.     while (!leaving)
  573.     {
  574.         ModalDialog(0L, &item);                // Simple modal dialog filtering.
  575.         
  576.         if (item == 1)                        // Did user hit the Okay button?
  577.         {                                    // Well see if volume entered is legal.
  578.             GetDialogNumFromStr(theDial, 3, &newVolume);
  579.             if ((newVolume >= 0) && (newVolume <= 7))
  580.             {                                // If it is legal, we'll note it and quit.
  581.                 thePrefs.wasVolume = (short)newVolume;
  582.                 SetSoundVol((short)newVolume);
  583.                 leaving = TRUE;                // Bye.
  584.             }
  585.             else                            // Otherwise, the volume entered is wrong.
  586.             {                                // So we'll Beep, enter the last legal…
  587.                 SysBeep(1);                    // value and select the text again.
  588.                 SetDialogNumToStr(theDial, 3, (long)thePrefs.wasVolume);
  589.                 SelIText(theDial, 3, 0, 1024);
  590.             }
  591.         }
  592.         else if (item == 2)                    // Did the user hit the "Clear Scores"…
  593.         {                                    // button?
  594.             for (i = 0; i < 10; i++)        // Walk through and zero scores.
  595.             {
  596.                 PasStringCopy("\pNemo", thePrefs.highNames[i]);
  597.                 thePrefs.highScores[i] = 0L;
  598.                 thePrefs.highLevel[i] = 0;
  599.                 openTheScores = TRUE;        // Bring up scores when dialog quits.
  600.             }
  601.             DisableControl(theDial, 2);        // Gray out Clear Scores button.
  602.         }
  603.     }
  604.     
  605.     DisposDialog(theDial);                    // Clean up before going.
  606. }
  607.  
  608.